Current Location: Home> Function Categories> idate

idate

Format local time/date as integer
Name:idate
Category:Date and time
Programming Language:php
One-line Description:Format local time/date as integers.

Definition and usage

idate() function formats the local time/date as an integer.

Note: The idate() function only accepts one character as format parameter!

Example

Format local time/date as integer. Test all different formats:

 <?php
echo IDate ( "B" ) . "<br>" ;
echo IDate ( "d" ) . "<br>" ;
echo IDate ( "h" ) . "<br>" ;
echo IDate ( "H" ) . "<br>" ;
echo IDate ( "i" ) . "<br>" ;
echo IDate ( "I" ) . "<br>" ;
echo IDate ( "L" ) . "<br>" ;
echo IDate ( "m" ) . "<br>" ;
echo IDate ( "s" ) . "<br>" ;
echo IDate ( "t" ) . "<br>" ;
echo IDate ( "U" ) . "<br>" ;
echo IDate ( "w" ) . "<br>" ;
echo IDate ( "W" ) . "<br>" ;
echo IDate ( "y" ) . "<br>" ;
echo IDate ( "Y" ) . "<br>" ;
echo IDate ( "z" ) . "<br>" ;
echo IDate ( "Z" ) . "<br>" ;
?>

Try it yourself

grammar

 IDate ( format , timestamp ) ;
parameter describe
format

Required. Specifies how to return the result:

  • B - Swatch Beat/Internet Time
  • d - What day of a month
  • h - hours (12-hour system)
  • H - Hours (24-hour system)
  • i - points
  • I - Return 1 if Daylight Saving Time is enabled, otherwise return 0
  • L - Return 1 if leap year, otherwise return 0
  • m - Number of months
  • s - seconds
  • t - Total days of the month
  • U - The number of seconds elapsed since the Unix Era (January 1 1970 00:00:00 GMT), the same as time()
  • w - What day of the week (Sunday is 0)
  • W - How many weeks in the ISO-8601 format year, each week starts on Monday
  • y - Year (1 or 2 digits)
  • Y - Year (4 digits)
  • z - What day of the year
  • Z - Time zone offset in seconds
timestamp Optional. Specifies a Unix timestamp that represents the date/time that needs to be formatted. The default is the current local time (time()).
Similar Functions
Popular Articles